/**
 * @file 概览报表
 * @author hanzhichen(hanzhichen@baijia.com)
 * @date 2020-01-07
 */
import React, {useState} from 'react';
import {Card} from 'antd';
import moment from 'moment';
import CommonTitle from '../common/Title';
import {IncomeDashBoard, TransformIncomeDashBoard} from './comps';
import './index.styl';

const initOriginPaidDay = [
    moment()
        .subtract(1, 'days')
        .startOf('month'),
    moment()
        .subtract(1, 'days')
        .endOf('month')
];

export default function GeneralViewReport(props) {
    // 全部看板共用一个支付时间, 支付时间写在第一个里面, 后面的引用第一个里面的值...只能这样搞了
    const [originPaidDay, setOriginPaidDay] = useState(initOriginPaidDay);
    const handleOriginPaidDayChange = newOriginPaidDay => {
        setOriginPaidDay(newOriginPaidDay);
    };
    return (
        <div className="income-container">
            <CommonTitle title="概览看板" />
            <IncomeDashBoard
                initOriginPaidDay={initOriginPaidDay}
                onOriginPaidDayChange={handleOriginPaidDayChange}
            />
            <TransformIncomeDashBoard originPaidDay={originPaidDay} />
        </div>
    );
}
